package com.itheima.d1_extends.demo01;

/**
 * 动物类（作为父类，放入子类们的共有内容，作为基础的属性和功能！）
 */
public class Animal {
    //属性：姓名和年龄
    private String name;
    private int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Animal() {
    }

    //Getter and Setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //继续练习的需求：新增功能（喝水）
    public void drink() {
        System.out.println("喝水！");
    }
}
